<?php 
	require "../Security/validateSession.php";
	require "../classes/DB.php";
	require "../lib/menu.php";
	require "../lib/utils.php";
	checkSession();
?>
<html><!-- InstanceBegin template="/Templates/tmpl.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Operadora IRENK</title>
<!-- InstanceEndEditable -->

<script language="javascript" src="../js/utils.js"></script>
<link href="../css/base.css" rel="stylesheet" type="text/css" />
<link href="../css/irenk.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body topmargin="0">
<table border="0" cellpadding="0" cellspacing="0" align="center" style="height:100%;">
    <tr>
    <td height="100%" width="25" class="leftMargin" ></td>
    <td><table width="900" border="0" align="center" cellpadding="0" cellspacing="0" height="100%">
        <tr>
          <td class="headerPixel" width="500" height="70" valign="top">
          	&nbsp;&nbsp;&nbsp;
            <img src="../images/temp/logo.jpg"></td>
            <td class="header" width="205" height="70"></td>
        </tr>
        <tr>
            <td class="back" colspan="2">
       	  	<table border="0" cellpadding="0" cellspacing="0" width="900" height="100%">
                	<tr>
                    	<td width="170" valign="top">
                        	<?php 
							echo '<br />&nbsp;&nbsp;&nbsp;Bienvenido(a)<br>&nbsp;&nbsp;&nbsp;'.$_SESSION["Nombre"].'<br />';
							createMenu(); 
							
							?>
                        </td>
                        <td rowspan="2" width="712" align="center" valign="top">
                        	<br />
                            <!-- InstanceBeginEditable name="submenu" -->
                            <?php 								
								$tipo='Agencia';
								$seccion=0;
								createSub($tipo,$seccion);
							?>
                            <!-- InstanceEndEditable -->
                        	<!-- InstanceBeginEditable name="body" -->                            	
               		  			<table class="mainTable"  cellpadding="0" cellspacing="0" width="95%" height="90%">
                                	<tr><th>Promociones</th></tr>
                                    <tr><td valign="top"><hr /></td></tr>
                                    <tr>
                                    	<td valign="top" align="center">
                                        	<?php 
												require_once("../classes/Promociones.php");
												if(isset($_REQUEST['page'])){
													$pactual=$_REQUEST['page'];
												}else
													$pactual=1;
												if(isset($_REQUEST['tpag'])){
													$total_paginas=$_REQUEST['tpag'];
												}else
													$total_paginas=1;
												$tamPag=15;
												$promocionesArr = Promociones::getPromocionesListByDate($pactual,$tamPag);
												$total_reg=count($promocionesArr);
												$total_paginas = ceil($total_reg / $tamPag);
												if (count($promocionesArr)>0) {
													
													
													?>
													<table class="report" border="0" cellpadding="0" cellspacing="0" align="center" style="height:100%;">
														<tr>
															<th class='formLabel' scope='col'>No. Promoci&oacute;n</th>
					                                        <th class='formLabel' scope='col'>Hotel</th>
					                                        <th class='formLabel' scope='col'>Destino</th>
					                                        <th class='formLabel' scope='col'>Fecha Inicio</th>
					                                        <th class='formLabel' scope='col'>Fecha Termina</th>
					                                        <th class='formLabel' scope='col' >Descripci&oacute;n</th>
					                                        <th class='formLabel' scope='col' >Condiciones</th>
					                                        <th class='formLabel' scope='col' >Comentarios</th>
					                                        <th class='formLabel' scope='col' >Aplica</th>
														</tr>
													<?php
													foreach($promocionesArr as $promocion){
														echo "<tr>
															<td>".$promocion->id_Promocion."</td>
															<td>".$promocion->Hotel."</td>
															<td>".$promocion->destino."</td>
															<td>".$promocion->fecha_Inicio."</td>
															<td>".$promocion->fecha_Termino."</td>
															<td>".$promocion->descripcion."</td>
															<td>".$promocion->sentencia."</td>
															<td>".$promocion->comentarios."</td>
															<td>".$promocion->aplica."</td>
															</tr>";
													}
														echo "<tr><td colspan='9' align='center'>";
														indicePaginacion($total_paginas,$pactual,"Promociones.php&tpag={$total_paginas}");
														echo "</td></tr>"
													?>
													</table>
													<?php
												}else{
													echo "No exiten Promociones para los siguientes 30 dias.";
												}
												
											?>
                                        </td>
                                    </tr>
                                </table>                            
                            <!-- InstanceEndEditable -->
                            <br />
                        </td>
                  </tr>
                  <tr>
                  	<td class="menuImage" width="170">&nbsp;</td>                  
                  </tr>
                </table>
            </td>
        </tr>
        <tr>
          <td colspan="2" class="footer" height="24"></td>
        </tr>
    </table></td>
  	<td width="25" class="rightMargin"></td>
	</tr>
</table>
</body>
<!-- InstanceEnd --></html>
